import type { CrudSchema } from '@/hooks/web/useCrudSchemas'

// 表单校验
export const rules = reactive({
  roleId: [required],
  name: [required],
  rpg: [required],
  heartbeatLevel: [required],
  duration: [required],
  fileId: [required]
})

// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
const crudSchemas = reactive<CrudSchema[]>([
  {
    label: '场景id',
    field: 'id',
    isForm: false
  },
  {
    label: '角色id',
    field: 'roleId',
    isSearch: false,
    form: {
      component: 'InputNumber',
      value: 0
    }
  },
  {
    label: '场景名称',
    field: 'name',
    isSearch: true
  },
  {
    label: '角色扮演',
    field: 'rpg',
    isSearch: false
  },
  {
    label: '心跳指数',
    field: 'heartbeatLevel',
    isSearch: false,
    form: {
      component: 'InputNumber',
      value: 0
    }
  },
  {
    label: '时间长度（秒）',
    field: 'duration',
    form: {
      component: 'InputNumber',
      value: 0
    }
  },
  {
    label: '音频文件',
    field: 'fileId',
    isTable: false,
    form: {
      component: 'UploadFile'
    }
  },
  {
    label: '场景中的Prompts',
    field: 'prompt',
    isTable: false,
    form: {
      component: 'Input',
      componentProps: {
        type: 'textarea',
        rows: 4
      },
      colProps: {
        span: 24
      }
    }
  },
  {
    label: '操作',
    field: 'action',
    isForm: false
  }
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
